<?php
/**
 * Created by PhpStorm.
 * User: linvscode      魔术方法
 * Date: 2018/7/29
 * Time: 15:42
 */
namespace IMooc;

class Objects
{
    static function test()
    {
        echo __FILE__;
    }
    protected $array = [];
    function __set($name, $value)
    {
        // TODO: Implement __set() method.
        $this->array[$name] = $value;
    }

    function __get($name)
    {
        var_dump(__METHOD__);
        // TODO: Implement __get() method.
        return $this->array[$name];
    }

    function __call($name, $arguments)
    {
        // TODO: Implement __call() method.
        var_dump($name, $arguments);
        return "magic function";
    }

    static function __callStatic($name, $arguments)
    {
        // TODO: Implement __callStatic() method.
        var_dump($name, $arguments);
        return "magic static function";
    }

    function __toString()   //对象自动转化为字符串
    {
        // TODO: Implement __toString() method.
        return __CLASS__;
    }

    function __invoke($param)
    {
        // TODO: Implement __invoke() method.
        var_dump($param);
        return "__invoke";
    }
}